import { mongo } from "../mogoConfig";

// 更新第一个item等于paper的文档

const db = mongo.db("my_test")
db.collection("inventory")
    .replaceOne(
        { item: 'paper' },
        {
            item: 'paper',
            instock: [
                { warehouse: 'A', qty: 60 },
                { warehouse: 'B', qty: 40 }
            ]
        }


    ).then(result => {
        console.log(JSON.stringify(result))
    }).catch(error => {
        console.log(error)
    }).finally(() => {
        mongo.close()
    })

console.log("执行结束")